<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$("#deleteFile").click(function(){
			var newFileName = $("#newFileName").val();
			$.ajax({
				type:"POST",
				url:"deleteUploadFile_board.do",
				data:"newFileName="+newFileName,
				dataType:"JSON",
				success:function(jsonData){
					if(jsonData==true){
						$("#uploadView").html("<input type='file' name='uploadFile'>");
					}
				}
			});
		});
	});
	
	$(document).ready(function(){
		$(":submit[name=updateBoard]").click(function(){
			if($("#content").val()==""){
				alert("글을 입력하세요");
				return false;
			}
			if($(":text[name=title]").val()==""){
			alert("제목을입력하세요");
			return false;
		}
		});
	});
	
</script>
<style type="text/css">
.updateboardBtn {
	font-size:12px;
	font-family:Verdana;
	font-weight:bold;
	-moz-border-radius:2px;
	-webkit-border-radius:2px;
	border-radius:2px;
	border:1px solid #dcdcdc;
	padding:5px 10px;
	text-decoration:none;
	background:-webkit-gradient( linear, left top, left bottom, color-stop(5%, #d9d5d9), color-stop(100%, #bababa) );
	background:-moz-linear-gradient( center top, #d9d5d9 5%, #bababa 100% );
	background:-ms-linear-gradient( top, #d9d5d9 5%, #bababa 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#d9d5d9', endColorstr='#bababa');
	background-color:#d9d5d9;
	color:#4f4f4f;
	display:inline-block;
	text-shadow:0px 0px 0px #ffffff;
 	-webkit-box-shadow:inset 0px 0px 0px 0px #ffffff;
 	-moz-box-shadow:inset 0px 0px 0px 0px #ffffff;
 	box-shadow:inset 0px 0px 0px 0px #ffffff;
}.updateboardBtn:hover {
	background:-webkit-gradient( linear, left top, left bottom, color-stop(5%, #bababa), color-stop(100%, #d9d5d9) );
	background:-moz-linear-gradient( center top, #bababa 5%, #d9d5d9 100% );
	background:-ms-linear-gradient( top, #bababa 5%, #d9d5d9 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#bababa', endColorstr='#d9d5d9');
	background-color:#bababa;
}.updateboardBtn:active {
	position:relative;
	top:1px;
}
</style>

</head>
<body>
<c:if test="${requestScope.bvo.orgFileName!=null }">
<input type = "hidden" id = "newFileName" value = "${requestScope.bvo.orgFileName}">
</c:if>
<form method="post" action="updateBoard_board.do" enctype="multipart/form-data">
<center>
글번호: <input type="text" name="no" value="${requestScope.bvo.no }" readonly>|제목:<input type="text" name="title" value="${requestScope.bvo.title}" ><br>
닉네임 : <input type="text" name="nick" value="${requestScope.bvo.memberVO.nick }" readonly>|작성일시 : ${requestScope.bvo.writeDate} <br>
<c:if test="${requestScope.boardNo==20||requestScope.boardNo==13}">
	<span id="uploadView">
		<c:if test="${requestScope.bvo.orgFileName!=null }">
			${requestScope.bvo.orgFileName}
			<input type = "button" id = "deleteFile" value = "파일 삭제" class="updateboardBtn">
		</c:if>
	</span>
</c:if>
<hr>
<textarea name="content" id="content" rows="15" cols="40">${requestScope.bvo.content }</textarea> <br>

<input type="hidden" name="boardNo" value="${requestScope.boardNo}">
<input type="hidden" name="page" value="${requestScope.page}">
						<br><input type="submit" class="updateboardBtn" value="수정하기" name="updateBoard">
</center>
</form>
</body>
</html>